import haxe.remoting.Connection;

class ITMChat { 
	static public function said(name, text) {}
	static public function joined(name) {}
	static public function left(name) {}
	static public function getAndClearSayText() {}
}

class JsMain {

    static function said(name, text) { ITMChat.said(name, text); }
		
		static function joined(name) { ITMChat.joined(name); }
		
		static function left(name) { ITMChat.left(name); }
		
		static function say() { 
        var flash = haxe.remoting.Connection.flashConnect("ITMChatObject");
        trace(flash.Client.say.call([ ITMChat.getAndClearSayText() ]));
		}

		static function join() { 
				trace('join1');
        var flash = haxe.remoting.Connection.flashConnect("ITMChatObject");
				trace('join2');
        flash.Client.join.call([]);
				trace('join3');
		}

		static function leave() { 
        var flash = haxe.remoting.Connection.flashConnect("ITMChatObject");
        trace(flash.Client.leave.call([]));
		}
		
		static function main() {
    }

}